import math

print("""
❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤
您是否还在为满页的口算题而头疼？
您是否还在担心明天的作业怎么办？
鸭梨牌计算器
你值得拥有~

发布时间：2025年3月26日
版本号： 内测版

❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤
""")
def Csum(num1, num2):
    return num1 + num2

def Csub(num1, num2):
    return num1 - num2

def Cmuliti(num1, num2):
    return num1 * num2

def Cdiv(num1, num2):
    if num2 == 0:
        print("除数不为0")
        return 0
    return num1 / num2

def logab(num1, num2):
    if num1<=0 or num2 <=0:
        print("指数和对数都应该大于0哟~~~")
    return math.log(num1, num2)

def yushu(num1,num2):
    if num2 == 0:
        print("除数不为0")
        return 0
    return num1 % num2

def mi(num1, num2):
    return num1 ** num2

def sqrt(num1):
    if num1 < 0:
        print("被开方的数必须是正数哦~~")
        return None
    return math.sqrt(num1)

def sin(num1):
    return math.sin(math.radians(num1))

def cos(num1):
    return math.cos(math.radians(num1))

def tan(num1):
    return math.tan(math.radians(num1))

flag = True
while flag:
    if input ("请问：需要复数（1）还是整数（2）运算\n")=="1":
        num1 = complex(input("请输入一个复数："))
        num2 = complex(input("请输入另一个复数："))
        choice = input("请输入运算符(+,-,*,/)")
        if choice == "+":
            print("num1", choice, "num2 =", Csum(num1, num2))
        elif choice == "-":
            print("num1", choice, "num2 =", Csub(num1, num2))
        elif choice == "*":
            print("num1", choice, "num2 =", Cmuliti(num1, num2))
        elif choice == "/":
            print("num1", choice, "num2 =", Cdiv(num1, num2))

    else:
        num1 = int(input("请输入一个数："))
        num2 = int(input("请输入另一个数："))
        choice = input("请输入运算符(+,-,*,/,log,%，**，sqrt，sin，cos，tan)：")
        if choice == "+":
            print("num1", choice, "num2 =", Csum(num1, num2))
        elif choice == "-":
            print("num1", choice, "num2 =", Csub(num1, num2))
        elif choice == "*":
            print("num1", choice, "num2 =", Cmuliti(num1, num2))
        elif choice == "/":
            print("num1", choice, "num2 =", Cdiv(num1, num2))
        elif choice == "log":
            print("log以",num2,"为底",  num1,"的对数=", logab(num1, num2))
        elif choice == "%":
            print("num1", choice, "num2 =", yushu(num1, num2))
        elif choice == "**":
            print("num1", choice, "num2 =", mi(num1, num2))
        elif choice == "sqrt":
            print("num1","的平方根是" , sqrt(num1))
        elif choice == "sin":
            print("num1","的sin是" , sin(num1))
        elif choice == "cos":
            print("num1","的cos是" , cos(num1))
        elif choice == "tan":
            print("num1","的tan是" , tan(num1))



    conti =input("是否继续？Y/N")
    if conti == "Y"or conti =="y":
        flag = True
    else:
        flag = False